package com.care.system.server.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.care.common.core.domain.Result;
import com.care.system.server.mapper.TRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.care.system.server.mapper.TPurseMapper;
import com.care.system.common.domain.TPurse;
import com.care.system.server.service.ITPurseService;

/**
 * 我的钱包Service业务层处理
 *
 * @author 李光耀负责
 * @date 2024-03-25
 */
@Service
public class TPurseServiceImpl implements ITPurseService
{
    @Autowired
    private TPurseMapper tPurseMapper;

    @Autowired
    private TRecordMapper tRecordMapper;

    /**
     * 查询我的钱包
     *
     * @param purseId 我的钱包主键
     * @return 我的钱包
     */
    @Override
    public TPurse selectTPurseByPurseId(Long purseId)
    {
        return tPurseMapper.selectTPurseByPurseId(purseId);
    }

    /**
     * 查询我的钱包列表
     *
     * @param tPurse 我的钱包
     * @return 我的钱包
     */
    @Override
    public List<TPurse> selectTPurseList(TPurse tPurse)
    {
        return tPurseMapper.selectTPurseList(tPurse);
    }

    /**
     * 新增我的钱包
     *
     * @param tPurse 我的钱包
     * @return 结果
     */
    @Override
    public int insertTPurse(TPurse tPurse)
    {
        return tPurseMapper.insertTPurse(tPurse);
    }

    /**
     * 修改我的钱包
     *
     * @param tPurse 我的钱包
     * @return 结果
     */
    @Override
    public int updateTPurse(TPurse tPurse)
    {
        return tPurseMapper.updateTPurse(tPurse);
    }

    /**
     * 批量删除我的钱包
     *
     * @param purseIds 需要删除的我的钱包主键
     * @return 结果
     */
    @Override
    public int deleteTPurseByPurseIds(Long[] purseIds)
    {
        return tPurseMapper.deleteTPurseByPurseIds(purseIds);
    }

    /**
     * 删除我的钱包信息
     *
     * @param purseId 我的钱包主键
     * @return 结果
     */
    @Override
    public int deleteTPurseByPurseId(Long purseId)
    {
        return tPurseMapper.deleteTPurseByPurseId(purseId);
    }

    @Override
    public Result<TPurse> selectPurseListByUserId(Long userId) {
        TPurse purse = tPurseMapper.selectPurseListByUserId(userId);
        return Result.success (purse);
    }

}
